package homework.api02.homework_api01;

public class MatchesDemo {
    public static void main(String[] args) {

        //邮箱的正则表达式：
        //[a-zA-Z0-9_]+@[a-zA-Z0-9]+[\.[a-zA-Z]+]+
        String email = "wangkj@tedu.cn";
        String regex = "[a-zA-Z0-9_]+@[a-zA-Z0-9]+[\\.[a-zA-Z]+]+";
        //使用regex匹配email内容是否符合格式要求
        boolean match = email.matches(regex);
        if (match){
            System.out.println("是正确的邮箱格式");
        }else {
            System.out.println("不是正确的邮箱格式");
        }

    }
}
